package chances.webui.model;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.Map.Entry;

@SuppressWarnings("serial")
public class Timeline implements java.io.Serializable {
	
	private Map<String, Object> lookups = new LinkedHashMap<String, Object>();
	private List<TimelineNode> timelineNodes = new ArrayList<TimelineNode>();
		
	public Set<Entry<String, String>> getLookupNames() {
		Map<String, String> value = new HashMap<String, String>();
		this.timelineNodes.stream().filter(s -> Objects.nonNull(s.getLookup())).forEach(s -> {
			value.put(s.getField(), s.getField() + "Lookup");
		});
		return value.entrySet();
	}
	
	public void addTimelineNode(TimelineNode timelineNode) {
		this.timelineNodes.add(timelineNode);
	}
		
	public Map<String, Object> getLookups() {
		return lookups;
	}
	public void setLookups(Map<String, Object> lookups) {
		this.lookups = lookups;
	}

	public List<TimelineNode> getTimelineNodes() {
		return timelineNodes;
	}

	public void setTimelineNodes(List<TimelineNode> timelineNodes) {
		this.timelineNodes = timelineNodes;
	}

}
